// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境
const db = cloud.database()
// 云函数入口函数
exports.main = async (event, context) => {
  if(event.canteenType == 1){
    return await db.collection('canteen')
    .where({
      type:"米粉面条"
    })
   // .orderBy("sell",'desc')
    // .limit(5)
    .get()
  }else if(event.canteenType == 2){
    return await db.collection('canteen')
    .where({
      type:"甜点饮品"
    })
    .get()
  }else if(event.canteenType == 3){
  return await db.collection('canteen')
  .where({
    type:"汉堡炸鸡"
  })
  .get()
  }else if(event.canteenType == 4){
  return await db.collection('canteen')
  .where({
    type:"米饭主食"
  })
  .get()
}

}